﻿using System;
using System.Configuration;
using System.Data.Linq;
using System.Linq;
using Controllers;

namespace Web
{
    public partial class AuditionInfo : System.Web.UI.Page
    {
        protected AuditionMain auditionMain;
        protected string deptName;
        protected void Page_Load(object sender, EventArgs e)
        {
            ApolloOaDataContext ctx = new ApolloOaDataContext(ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString);
            string id = Request.QueryString["id"];
            DataLoadOptions dlo = new DataLoadOptions();
            dlo.LoadWith<AuditionMain>(r => r.AuditionSubs);
            ctx.LoadOptions = dlo;
            auditionMain = ctx.AuditionMains.Single(r => r.Id == int.Parse(id));

            var v = ctx.Depts.Single(r => r.Id == auditionMain.DeptId);
            deptName = v.Text;

            rptList.DataSource = auditionMain.AuditionSubs;
            rptList.DataBind();
        }
    }
}